home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Amos / SupraProcs / Zoom.AMOS / Zoom.amosSourceCode
Encoding:
AMOS Source Code  |  1996-01-26  |  2.5 KB  |  68 lines

  1. '   ******************************************************** 
  2. '   ***                                                  *** 
  3. '   ***                   Zoom Procedure                 *** 
  4. '   ***                                                  *** 
  5. '   ***                         by                       *** 
  6. '   ***                                                  *** 
  7. '   ***                    Joseph Bolin                  *** 
  8. '   ***                                                  *** 
  9. '   ******************************************************** 
  10.  
  11.  
  12. Screen Open 0,320,200,16,Lowres
  13. Cls 0
  14. Flash Off 
  15. For C=0 To 15
  16. Colour C,C*$100
  17. Next 
  18. For Y=1 To 15
  19.    For X=1 To 15
  20.       C=(Point(X-1,Y)+Point(X,Y-1))/2+Rnd(2)
  21.       If C>15 Then C=14
  22.       Plot X,Y,C
  23.    Next 
  24. Next 
  25. _ZOOM[2,0,0,0,16,16,0,64,0]
  26. _ZOOM[4,0,0,0,16,16,0,128,0]
  27. _ZOOM[8,0,0,0,16,16,0,64,72]
  28.  
  29. Procedure _ZOOM[_POWER,_SOURCE,_XSTART,_YSTART,_XEND,_YEND,_DEST,_XDEST,_YDEST]
  30.  
  31.    ' Inputs:  _POWER   Zoom factor: 2, 4, or 8
  32.    '          _SOURCE  Screen to zoom from  
  33.    '          _XSTART  Zoom start x pos       (multiple of 16)  
  34.    '          _YSTART  Zoom start y pos 
  35.    '          _XEND    Zoom end x pos (+1)    (Size must be multiple of 16) 
  36.    '          _YEND    Zoom end y pos (+1)  
  37.    '          _DEST    Screen to zoom to  
  38.    '          _XDEST   Zoom destination x pos (multiple of 16)  
  39.    '          _YDEST   Zoom destination y pos 
  40.    '
  41.    ' Output:  Zooms the source area to the destination area and expands it
  42.    If _POWER<>2 and _POWER<>4 and _POWER<>8 Then Error 23
  43.    If _XEND<_XSTART Then Swap _XSTART,_XEND
  44.    If _YEND<_YSTART Then Swap _YSTART,_YEND
  45.    _XSTART=_XSTART and 1008
  46.    _XDEST=_XDEST and 1008
  47.    If _XSTART<0 Then _XSTART=0
  48.    If _YSTART<0 Then _YSTART=0
  49.    If _XDEST<0 Then _XDEST=0
  50.    If _YDEST<0 Then _YDEST=0
  51.    _XSIZE=_XEND-_XSTART and 1016
  52.    _YSIZE=_YEND-_YSTART
  53.    If _POWER=2 or _POWER=4 Then _XSIZE=_XSIZE and 1008
  54.    If _XSIZE=0 or _YSIZE=0 Then Error 23
  55.    SC=Screen : Screen _SOURCE : SCB=Screen Base
  56.    If _XSTART+_XSIZE>Screen Width Then _XSIZE=Screen Width-_XSTART
  57.    If _XSIZE<0 Then Error 23
  58.    If _YSTART+_YSIZE>Screen Height Then _YSIZE=Screen Height-_YSTART
  59.    If _YSIZE<0 Then Error 23
  60.    Screen DES
  61.    If _XSTART+_XSIZE*_POWER>Screen Width Then Error 23
  62.    If _YSTART+_YSIZE*_POWER>Screen Height Then Error 23
  63.    _MLZOOM[_POWER,_XSTART,_YSTART,_XDEST,_YDEST,_XSIZE,_YSIZE,SCB,Screen Base]
  64.    Screen SC
  65. End Proc
  66. Procedure _MLZOOM[POWER,XS,YS,XD,YD,XSZ,YSZ,SRCSCB,DESSDCB]
  67.    ' COMPILED PROCEDURE -- can't convert this to AMOS code
  68. End Proc